package com.fluxtah.jordl.examples.twitter;

import com.fluxtah.jordl.lib.Transformer;
import com.fluxtah.jordl.lib.TransformException;
import java.util.List;
import org.json.JSONObject;
import org.json.JSONArray;

public class TwitterUserListOutputTransformer extends Transformer<List<TwitterUser>, JSONArray> {
	public void transform(List<TwitterUser> source, JSONArray target) throws TransformException {
		TwitterUserOutputTransformer itemTransformer = provider.get(TwitterUserOutputTransformer.class);
		for(TwitterUser sourceItem:source) {
			JSONObject targetItem = new JSONObject();
			itemTransformer.transform(sourceItem, targetItem);
			target.put(targetItem); 
		}
	}
}
